package com.zhongshengnetwork.rightbe.dbservice;

import com.zhongshengnetwork.rightbe.CustomApplication;
import com.zhongshengnetwork.rightbe.dbmodel.AddressdbModel;
import com.zhongshengnetwork.rightbe.dbmodel.SigndbModel;

import org.xutils.DbManager;
import org.xutils.ex.DbException;
import org.xutils.x;

/**
 * Created by zhongsheng-luojianlan on 17/1/18.
 */

public class SigndbService {
    //插入或者更新数据
    public static boolean saveOrUpdate(SigndbModel model){
        DbManager db = x.getDb(CustomApplication.daoConfig);
        try {
            db.saveOrUpdate(model);
            return true;
        } catch (DbException e) {
            e.printStackTrace();
            return false;
        }
    }

    //判断是否已经签到
    public static boolean isSign(String id){
        DbManager db = x.getDb(CustomApplication.daoConfig);
        try {
            if (db.findById(SigndbModel.class,id) != null){
                return true;
            }
            return false;
        } catch (DbException e) {
            e.printStackTrace();
            return false;
        }
    }
}
